import java.util.Arrays;

public class Main {

    public static void rOrder(int[] array){
        int left = 0;
        int right =array.length-1;
        while(left<right){
            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
            left++;
            right--;
        }
    }
    public static void main(String[] args) {
//        int[] array = {1,2,3,4};
//        rOrder(array);
//        System.out.println(Arrays.toString(array));


        //二维数组
        int [][] array1 = {{1,2,3},{4,5,6}};

        //遍历2维数组
        for (int i = 0; i < array1.length; i++) {
            for (int j = 0; j < array1[i].length; j++) {
                System.out.print(array1[i][j] + " ");
            }
            System.out.println();
        }
        //直接输出
        System.out.println(Arrays.deepToString(array1));


        int [][] array2 = new int[][]{{1,2,3},{4,5,6}};
        int [][] array3 = new int[2][3];//只定义了大小，默认元素是0

        //不规则二维数组
        int [][] array4 = new int[2][];//第二个可以不定义
        array4[0] = new int[]{1,2,3};
        array4[1] = new int[]{1,2,3,4,5,6};
        System.out.println(Arrays.deepToString(array4));
    }
}